<template>
  <div class="layui-layout layui-layout-admin">
    <div class="adminnav1">
      <Pagetop></Pagetop>
    </div>
    <div class="adminnav2">
      <Secondnav urlname="amount"></Secondnav>
    </div>

    <!-- 主体内容 -->
    <div class="layui-body kedou-admin" id="LAY_app_body app">
      <div class="layadmin-tabsbody-item layui-show">
        <div class="pagelist">
          <div class="layui-card-body">
            <fieldset class="layui-elem-field layui-field-title">
              <legend>UC明细列表</legend>
            </fieldset>
          </div>
          <div class="pagetop">
            <Search :seadate="searchArr"></Search>
          </div>
          <div class="layui-card-body">
            <Tables
              :fdate="pdate"
              :result="res"
              height="430"
              :totalCount="totalRows"
              :pageNumber="curindex"
              :fbtn="btn"
            ></Tables>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
    import Pagetop from '../common/pagetop.vue'
	import Secondnav from '../common/secondnav.vue'
	import Tables from '../common/tables.vue'
	import Search from '../common/search.vue'
export default {
  name: "uclist",
  components: { Pagetop, Secondnav, Tables, Search },
  data() { 
    return {
      pdate: [], //表头
      res: "", //内容
      totalRows: "", //总数量
      curindex: 1, //页数
      btn: [], //按钮
      searchArr: [], //搜索
      isShow: false,
      seapram: "",
      type: localStorage.getItem("type"),
    };
  },
  mounted() {
    this.getdate();
    this.getsearch();
  },
  methods: {
    getdate: function () {
      var _this = this;
      var url = "/crm/aapi/v1.9/currency";
      if (_this.seapram) {
        var dates = {
          size: pageSize,
          page: _this.curindex,
          assetType: "UC",
        //   sort:'createAt,DESC'
          //'status.equals':'ENABLE'
        };
        var res = _this.seapram;
        for (var i = 0; i < res.length; i++) {
          dates[res[i].key] = res[i].val;
        }
      } else {
        var dates = {
          size: pageSize,
          page: _this.curindex,
          assetType: "UC",
        //   sort:'createAt,DESC'
          //'status.equals':'ENABLE'
        };
      }
      //alert(url+"//"+JSON.stringify(dates))
      ajaxRequest(url, "GET", "json", dates, function (ret, err) {
        //alert(url+"//"+JSON.stringify(ret))
        var arr = [];
        arr[0] = [
          { field: "id", title: "ID" },
          { field: "accountShowName", title: "账号" },
          { field: "traderShowName", title: "交易方账号" },
          { field: "orderSerialNo", title: "交易流水号"},
          { field: "changeAmount", title: "交易金额",templet:function (d) {return d.changeAmount /100} },
          { field: "balance", title: "变更后的余额",templet:function (d) {return d.balance /100} },
          { field: "behaviorName", title: "交易类型"},
          {
            field: "createAt",
            title: "创建时间",
            templet: function (d) {
              return FormatDate(d.createAt, 3);
            },
          },
        ];
        _this.pdate = arr;
        _this.res = ret.data.list; //res1;
        _this.totalRows = ret.data.totalRows;
        _this.curindex = ret.data.page + 1;
      });
    },
    getsearch: function () {
      var arr = [{ field: "createDateBegin", title: "开始日期", type: "input" , id:'test'},
      { field: "createDateEnd", title: "结束日期", type: "input" , id:'test1'}];
      this.searchArr = arr;
    },
    page: function (index, obj) {
      //alert(JSON,stringify(obj))
      this.curindex = index;
      this.getdate();
    },
    sousuo: function (pram) {
      //alert(JSON.stringify(pram))
      this.seapram = pram;
      this.res = "";
      this.totalRows = "";
      this.curindex = "";
      this.getdate();
    },

    screens: function () {
      return screen();
    },
  },
  updated: function () {
    this.isShow = true;
    layui.use(["form","laydate"], function () {
      var form = layui.form;
      var laydate = layui.laydate;
      form.render();
      laydate.render({
        elem: "#test",
        type: "month",
      });
      laydate.render({
        elem: "#test1",
        type: "month"
      });
    });
  },
};
</script>
<style scoped>
/**/
</style>